var ibMarketInventory = {
	init: function()
	{
		Debug.write("Initializing ibm.inventory.js");
		
		document.observe("dom:loaded", function(){
			ibMarketInventory.loadButtons();
		});
	},
	
	loadButtons: function()
	{
		$$('.marketUse').each(function(button) {
			var invId = button.identify().sub('use_','');
			button.observe('click', function() {
				window.location.href = ipb.vars['base_url']+"app=ibmarket&module=inventory&section=item&item="+invId;
			});
		});
		$$('.marketResell').each(function(button) {
			var invId = button.identify().sub('resell_','');
			button.observe('click', function() {
				if(confirm(resellMessage))
				{
					window.location.href = ipb.vars['base_url']+"app=ibmarket&module=inventory&section=resell&item="+invId;
				}
			});
		});
	}
}

ibMarketInventory.init();